\documentclass{article}

\usepackage{pgfplots}

\pgfplotsset{compat=1.13}
\usepgfplotslibrary{patchplots}

\begin{document}


\def\PLOT[#1]{%
	\addplot[point meta=explicit symbolic,mesh/color input=explicit,#1]
	coordinates {
	(0,0) [color=red] (1,0) [color=blue] (2,0) [color=yellow]

	(0,1) [color=black] (1,1) [color=brown] (2,1) [color=magenta]

	(0,2) [color=green] (1,2) [color=red] (2,2) [color=white]
	};
}%

\def\PLOTnoscanline[#1]{%
	\addplot[point meta=explicit symbolic,mesh/color input=explicit,mesh/cols=3,#1]
	coordinates {
	(0,0) [color=red] (1,0) [color=blue] (2,0) [color=yellow]
	(0,1) [color=black] (1,1) [color=brown] (2,1) [color=magenta]
	(0,2) [color=green] (1,2) [color=red] (2,2) [color=white]
	};
}%

\begin{tikzpicture}
	%\tracingmacros=2 \tracingcommands=2
	\begin{axis}[
		axis on top,
		y dir=reverse,
		%enlargelimits={abs=1},
		enlargelimits=false,
		shader=flat corner,
		patch type=bilinear,
	]

	\PLOT[surf, mesh input=image]

	\PLOT[mark=*,%scatter,
		mark size=4pt,only marks]
		
	\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
	\begin{axis}[
		axis on top,
		y dir=reverse,
		shader=faceted interp,
		patch type=bilinear,
		enlargelimits=false,
	]

	\PLOT[surf, mesh input=image]

	\PLOT[mark=*,%scatter,
		mark size=4pt,only marks]
		
	\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
	%\tracingmacros=2 \tracingcommands=2
	\begin{axis}[
		axis on top,
		y dir=reverse,
		%enlargelimits={abs=1},
		enlargelimits=false,
		shader=flat corner,
		patch type=bilinear,
	]

\message{NO SCANLINE CASE^^J}
	\PLOTnoscanline[surf, mesh input=image]

	\PLOTnoscanline[mark=*,%scatter,
		mark size=4pt,only marks]
		
	\end{axis}
\end{tikzpicture}
\end{document}

